package com.peach.service.impl;

import com.peach.mapper.NewsMapper;
import com.peach.pojo.News;
import com.peach.pojo.NewsType;
import com.peach.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsServiceImpl implements NewsService {
    @Autowired
    private NewsMapper newsMapper;


    @Override
    public List<News> selectAllNewsNoConditions() {
        return newsMapper.selectAllNewsNoConditions();
    }

    @Override
    public List<News> selectAllNews(Integer newsTypeId, String newsTitle, String newsAuthor) {
        return newsMapper.selectAllNews(newsTypeId,newsTitle,newsAuthor);
    }

    @Override
    public Boolean updateOneNews(News news) {
        return newsMapper.updateOneNews(news);
    }

    @Override
    public Boolean deleteOneNews(Integer newsId) {
        return newsMapper.deleteOneNews(newsId);
    }

    @Override
    public Boolean insertOneNews(News news) {
        return newsMapper.insertOneNews(news);
    }

    @Override
    public List<News> selectNewsByTypeId(Integer newsId) {
        return newsMapper.selectNewsByTypeId(newsId);
    }

    @Override
    public News selectOneNews(Integer newsId) {
        return newsMapper.selectOneNews(newsId);
    }

    @Override
    public List<NewsType> selectAllNewsTypes() {
        return newsMapper.selectAllNewsTypes();
    }

    @Override
    public List<News> selectNewsByTypeIdReturnNews(Integer newsId) {
        return newsMapper.selectNewsByTypeIdReturnNews(newsId);
    }


}
